<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link href="css/shop.css" type="text/css" rel="stylesheet" />
		<link href="css/Sellerber.css" type="text/css" rel="stylesheet" />
		<link href="css/bkg_ui.css" type="text/css" rel="stylesheet" />
		<link href="font/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
		<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
		<script src="js/Sellerber.js" type="text/javascript"></script>
		<script type="text/javascript" src="js/jquery.cookie.js"></script>
		<script src="js/shopFrame.js" type="text/javascript"></script>
		<script src="js/jquery.dataTables.min.js"></script>
		<script src="js/jquery.dataTables.bootstrap.js"></script>
		<script src="js/layer/layer.js" type="text/javascript"></script>
		<script src="js/laydate/laydate.js" type="text/javascript"></script>
		<!--[if lt IE 9]>
<script src="js/html5shiv.js" type="text/javascript"></script>
<script src="js/respond.min.js"></script>
<script src="js/css3-mediaqueries.js"  type="text/javascript"></script>
  <![endif]-->
		<title>订单</title>

	</head>

	<body>
		<div class="margin order_style" id="page_style">
			<div class="sum_style margin-bottom ">
				<ul class="clearfix">
					<!--<li class="col-xs-3 ">
						<div class="sum_zone Amount">微信交易总额<span><em>￥</em><span id="totalMoney">0</span></span>
						</div>
					</li>-->
					<li class="col-xs-3 ">
						<div class="sum_yifu Amount">微信退款金额<span><em>￥</em><span id="refundMoney">0</span></span>
						</div>
					</li>
					<!--<li class="col-xs-3 ">
						<div class="sum_daifu Amount">微信结算金额<span><em>￥</em><span id="jiesuanMoney">0</span></span>
						</div>
					</li>-->
					<!--<li class="col-xs-3 ">
						<div class="sum_tuikuan Amount">退款金额<span><em>￥</em>3545元</span></div>
					</li>-->
				</ul>
				<ul class="clearfix">
					<!--<li class="col-xs-3 ">
						<div class="sum_zone Amount">支付宝交易总额<span><em>￥</em><span id="zfbtotalMoney">0</span></span>
						</div>
					</li>-->
					<li class="col-xs-3 ">
						<div class="sum_yifu Amount">支付宝退款金额<span><em>￥</em><span id="zfbrefundMoney">0</span></span>
						</div>
					</li>
					<!--<li class="col-xs-3 ">
						<div class="sum_daifu Amount">支付宝结算金额<span><em>￥</em><span id="zfbjiesuanMoney">0</span></span>
						</div>
					</li>-->
					<!--<li class="col-xs-3 ">
						<div class="sum_tuikuan Amount">退款金额<span><em>￥</em>3545元</span></div>
					</li>-->
				</ul>
			</div>
			<div class="status_order margin-bottom">
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="allBill">微信所有订单(0)</a>
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="youxiaoBill">微信有效订单(0)</a>
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="refundBill">微信退款订单(0)</a>
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="wuxiaoBill">微信无效订单(0)</a>
			</div>
			<div class="status_order margin-bottom">
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="zfballBill">支付宝所有订单(0)</a>
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="zfbyouxiaoBill">支付宝有效订单(0)</a>
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="zfbrefundBill">支付宝退款订单(0)</a>
				<a href="javascrpit:void" class="btn button_btn btn-info status_btn" id="zfbwuxiaoBill">支付宝无效订单(0)</a>
			</div>
			<div class="operation clearfix">
				<button class="btn button_btn btn-danger" type="button" id="exportTable"><i class="fa fa-edit"></i>&nbsp;导出报表</button>
				<div class="search  clearfix">
					<label class="label_name">订单号：</label>
					<input name="" type="text" class="form-control col-xs-6" style=" width:250px;" id="outTradeNo" />
					<label class="label_name">下单时间：</label>
					<input class="inline laydate-icon " id="start" type="text" style=" margin-right:10px; height:auto; float:left; width:150px;" />
					<button class="btn button_btn bg-deep-blue " onclick="" type="button" id="search"><i class="fa  fa-search"></i>&nbsp;搜索</button>
				</div>
			</div>
			<div class="List_display">

				<table class="table table_list table_striped table-bordered" id="sample-table">
					<thead>
						<tr>
							<th width="30"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
							<th width="50">排序</th>
							<th width="200">订单编号</th>
							<th width="150">下单时间</th>
							<th width="80">消费金额</th>
							<!--<th width="50">数量</th>-->
							<th width="100">状态</th>
							<th width="150">支付来源</th>
							<th width="">退款金额</th>
							<th width="150">操作</th>
						</tr>
					</thead>
					<tbody>
						<tr>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
	</body>

</html>
<script>
	var dataSet = [
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '1', '201608250560345', '2016-08-25 12:23:34', '345.50', '3', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="Order_detailed.html" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '2', '201608150560345', '2016-08-25 12:23:34', '145.50', '1', '未完成', '2016-08-28 15:23:12', '用户取消订单', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '3', '201608150560345', '2016-08-25 12:23:34', '145.50', '1', '未完成', '2016-08-28 15:23:12', '用户取消订单', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '4', '201608150560345', '2016-08-25 12:23:34', '145.50', '1', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '5', '201608150560345', '2016-08-25 12:23:34', '145.50', '1', '未完成', '2016-08-28 15:23:12', '买家未付款', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '6', '201608150560345', '2016-08-25 12:23:34', '145.50', '1', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '7', '201608150560345', '2016-08-25 12:23:34', '145.50', '1', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '8', '201608250560345', '2016-08-25 12:23:34', '345.50', '3', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '9', '201607250560345', '2016-08-25 12:23:34', '235.50', '2', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '10', '201608250560345', '2016-08-25 12:23:34', '345.50', '3', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
		['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '11', '201608250560345', '2016-08-25 12:23:34', '345.50', '3', '已完成', '2016-08-28 15:23:12', '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn">删除</a> <a href="javascript:void()" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn">查看</a>'],
	];
	jQuery(function($) {

		//页面初始化，请求数据接口，获取当天数据
		//ajax start
		$.ajax({
			type: "GET",
			url: "http://60.205.182.120:8080/HisBizPayWebservice/page/searchCancelBill",
			dataType: "json",
			success: function(data) {
				
				var ustatus = data.status;
				if(ustatus == "noUser")
				{
					layer.alert("用户登录已失效，请重新登录", {
						title: '提示框',
						icon: 1,
					});
					location.href = "login.html";
					return false;
				}
				
				//				alert(data.billList);
				var datelist = data.billList;

				//订单数量
				$('#allBill').html('微信所有订单(' + data.wxtotalCount + ")");
				$('#youxiaoBill').html('微信有效订单(' + data.wxyouxiaoCount + ")");
				$('#refundBill').html('微信退款订单(' + data.wxrefundCount + ")");
				$('#wuxiaoBill').html('微信无效订单(' + data.wxwuxiaoCount + ")");

				$('#totalMoney').html(data.wxtotalMoney);
				$('#refundMoney').html(data.wxrefundMoney);
				$('#jiesuanMoney').html(data.wxjiesuanMoney);
				
				
				//订单数量
				$('#zfballBill').html('支付宝所有订单(' + data.zfbtotalCount + ")");
				$('#zfbyouxiaoBill').html('支付宝有效订单(' + data.zfbyouxiaoCount + ")");
				$('#zfbrefundBill').html('支付宝退款订单(' + data.zfbrefundCount + ")");
				$('#zfbwuxiaoBill').html('支付宝无效订单(' + data.zfbwuxiaoCount + ")");

				$('#zfbtotalMoney').html(data.zfbtotalMoney);
				$('#zfbrefundMoney').html(data.zfbrefundMoney);
				$('#zfbjiesuanMoney').html(data.zfbjiesuanMoney);

				var listString = "";

				dataSet = new Array();
				$.each(datelist, function(index, item) {
					var payType = "";
					if(item.payType == "5") {
						payType = "微信";
					} else {
						payType = "支付宝";
					}

					var status = item.status;
					if(status.indexOf("4") > -1) {
						status = "已退款";
					} else if(status == "1") {
						status = "已支付";
					} else if(status == "6") {
						status = "交易已撤销";
					} else if(status == "0") {
						status = "未完成交易";
					} else if(status == "2") {
						status = "交易未支付";
					}

					var rmoney = item.rmoney;
					if(typeof(rmoney) == "undefined") {

						rmoney = "0.0";
					}

					var list = ['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '' + item.shunxu + '', '' + item.outTradeNo + '', '' + item.checkDate + '', '' + item.money + '', '' + status + '', '' + payType + '', '' + rmoney + '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn" style="display:none;">删除</a> <a href="Order_detailed.html" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn" style="display:none;">查看</a>'];

					//					var listString = "'<label><input type='checkbox' class='ace'><span class='lbl'></span></label>', ";
					//					listString += "'"+item.shunxu+"'";
					//					listString += ", '"+item.outTradeNo+"'";
					//					listString += ", '"+item.createTime+"', ";
					//					listString += "'"+item.money+"', ";
					//					listString += "'3', ";
					//					listString += "'"+status+"', ";
					//					listString += "'2016-08-28 15:23:12', ";
					//					listString += "''', ' <a href='javascript:void()' onclick='picture_del(this,' + 10001 + ')' class='btn btn-danger operation_btn'>删除</a> <a href='Order_detailed.html' onclick='picture_img(this,' + 234 + ')' class='btn bg-deep-blue operation_btn'>查看</a>'";

					dataSet.push(list);
				});
				//$(".search_Doclist").html(data.status);
				var oTable1 = $('#sample-table').dataTable({
					"data": dataSet,
					"width": "100%",
					"bLengthChange": false,
					"iDisplayLength": 20,
					//"columns" : _tableCols,
					/*"aaSorting": [
						[1, "desc"]
					], //默认第几个排序*/
					"bStateSave": true, //状态保存
					"searching": false,
					"aoColumnDefs": [{
						"orderable": false,
						"aTargets": [0, 2, 3, 5, 6, 7, 8]
					}]

				});
			}
		});
		//ajax start

		//搜索
		$('#search').on('click', function() {

			//订单号
			var outTradeNo = $('#outTradeNo').val();
			//			alert(outTradeNo);
			//时间
			var createTime = $('#start').val();
			//			alert(createTime);

			//ajax start
			$.ajax({
				type: "GET",
				url: "http://60.205.182.120:8080/HisBizPayWebservice/page/searchCancelBill",
				dataType: "json",
				data: {
					outTradeNo: outTradeNo,
					createTime: createTime
				},
				success: function(data) {
					//				alert(data.billList);
					var datelist = data.billList;

					//订单数量
					$('#allBill').html('微信所有订单(' + data.wxtotalCount + ")");
					$('#youxiaoBill').html('微信有效订单(' + data.wxyouxiaoCount + ")");
					$('#refundBill').html('微信退款订单(' + data.wxrefundCount + ")");
					$('#wuxiaoBill').html('微信无效订单(' + data.wxwuxiaoCount + ")");
	
					$('#totalMoney').html(data.wxtotalMoney);
					$('#refundMoney').html(data.wxrefundMoney);
					$('#jiesuanMoney').html(data.wxjiesuanMoney);
					
					
					//订单数量
					$('#zfballBill').html('支付宝所有订单(' + data.zfbtotalCount + ")");
					$('#zfbyouxiaoBill').html('支付宝有效订单(' + data.zfbyouxiaoCount + ")");
					$('#zfbrefundBill').html('支付宝退款订单(' + data.zfbrefundCount + ")");
					$('#zfbwuxiaoBill').html('支付宝无效订单(' + data.zfbwuxiaoCount + ")");
	
					$('#zfbtotalMoney').html(data.zfbtotalMoney);
					$('#zfbrefundMoney').html(data.zfbrefundMoney);
					$('#zfbjiesuanMoney').html(data.zfbjiesuanMoney);

					var listString = "";

					dataSet = new Array();
					$.each(datelist, function(index, item) {
						var payType = "";
						if(item.payType == "5") {
							payType = "微信";
						} else {
							payType = "支付宝";
						}

						var status = item.status;
						if(status.indexOf("4") > -1) {
							status = "已退款";
						} else if(status == "1") {
							status = "已支付";
						} else if(status == "6") {
							status = "交易已撤销";
						} else if(status == "0") {
							status = "未完成交易";
						} else if(status == "2") {
							status = "交易未支付";
						}

						var rmoney = item.rmoney;
						if(typeof(rmoney) == "undefined") {

							rmoney = "0.0";
						}

						var list = ['<label><input type="checkbox" class="ace"><span class="lbl"></span></label>', '' + item.shunxu + '', '' + item.outTradeNo + '', '' + item.checkDate + '', '' + item.money + '', '' + status + '', '' + payType + '', '' + rmoney + '', ' <a href="javascript:void()" onclick="picture_del(this,' + 10001 + ')" class="btn btn-danger operation_btn" style="display:none;">删除</a> <a href="Order_detailed.html" onclick="picture_img(this,' + 234 + ')" class="btn bg-deep-blue operation_btn" style="display:none;">查看</a>'];

						//					var listString = "'<label><input type='checkbox' class='ace'><span class='lbl'></span></label>', ";
						//					listString += "'"+item.shunxu+"'";
						//					listString += ", '"+item.outTradeNo+"'";
						//					listString += ", '"+item.createTime+"', ";
						//					listString += "'"+item.money+"', ";
						//					listString += "'3', ";
						//					listString += "'"+status+"', ";
						//					listString += "'2016-08-28 15:23:12', ";
						//					listString += "''', ' <a href='javascript:void()' onclick='picture_del(this,' + 10001 + ')' class='btn btn-danger operation_btn'>删除</a> <a href='Order_detailed.html' onclick='picture_img(this,' + 234 + ')' class='btn bg-deep-blue operation_btn'>查看</a>'";

						dataSet.push(list);
					});

					//$(".search_Doclist").html(data.status);
					$('.table').dataTable().fnClearTable(); //将数据清除
					$('#sample-table').dataTable().fnAddData(dataSet); //重新绑定table数据
					$('#sample-table').dataTable({
						retrieve: true,
						"data": dataSet,
						"width": "100%",
						"bLengthChange": false,
						"iDisplayLength": 20,
						//"columns" : _tableCols,
						"aaSorting": [
							[1, "desc"]
						], //默认第几个排序
						"bStateSave": true, //状态保存
						"searching": false,
						"aoColumnDefs": [{
							"orderable": false,
							"aTargets": [0, 2, 3, 5, 6, 7, 8]
						}]

					});
				}
			});
			//ajax start

		});

		//导出报表
		$('#exportTable').click(function() {
			//订单号
			var outTradeNo = $('#outTradeNo').val();
			//			alert(outTradeNo);
			//时间
			var createTime = $('#start').val();
			//			alert(createTime);

			location.href = 'http://60.205.182.120:8080/HisBizPayWebservice/page/exportBill2?outTradeNo='+outTradeNo+'&createTime='+createTime;


			/*//ajax start
			$.ajax({
				type: "GET",
				url: "http://60.205.182.120:8080/HisBizPayWebservice/page/exportBill",
				dataType: "json",
				data: {
					outTradeNo: outTradeNo,
					createTime: createTime
				},
				success: function(data) {
					alert($111);
				}
			});
			//ajax start*/
		});

		$('table th input:checkbox').on('click', function() {
			var that = this;
			$(this).closest('table').find('tr > td:first-child input:checkbox')
				.each(function() {
					this.checked = that.checked;
					$(this).closest('tr').toggleClass('selected');
				});

		});
	});
	/*产品-删除*/
	function picture_del(obj, id) {
		layer.confirm('确认要删除吗？', {
			icon: 0,
		}, function(index) {
			$(obj).parents("tr").remove();
			layer.msg('已删除!', {
				icon: 1,
				time: 1000
			});
		});
	}
	/*******滚动条*******/
	$("body").niceScroll({
		cursorcolor: "#888888",
		cursoropacitymax: 1,
		touchbehavior: false,
		cursorwidth: "5px",
		cursorborder: "0",
		cursorborderradius: "5px"
	});
	/*时间*/
	laydate({
		elem: '#start',
		event: 'focus'
	});
</script>